package cn.falcon.fmobi.console.requestparam;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class CreativeQuery extends AbstractPagingSortParam {

    private Integer campaignId;
    private Integer promotionPlanId;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @NotNull
    private Date startDate;
    @DateTimeFormat(pattern = "yyy-MM-dd")
    @NotNull
    private Date endDate;
    private String search;

    public Integer getCampaignId() {
        return campaignId;
    }

    public void setCampaignId(Integer campaignId) {
        this.campaignId = campaignId;
    }

    public Integer getPromotionPlanId() {
        return promotionPlanId;
    }

    public void setPromotionPlanId(Integer promotionPlanId) {
        this.promotionPlanId = promotionPlanId;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getSearch() {
        return search;
    }

    public void setSearch(String search) {
        this.search = search;
    }

    @JsonIgnore
    public Map<String,Object> getSearchMap(){
        Map<String,Object> map=new HashMap<>();
        map.put("campaignId",this.campaignId);
        map.put("promotionPlanId",this.promotionPlanId);
        map.put("search",this.search);
        map.put("startDate",this.startDate);
        map.put("endDate",this.endDate);
        return map;
    }
}
